#![allow(dead_code, unused_variables)]
mod cpu;
mod isa;
mod memory;
mod monitor;
mod utils;

use std::{env::args, path::Path};

use monitor::Debugger;

use crate::isa::{CpuOf, MemoryOf, Riscv64};

fn main() -> std::io::Result<()> {
    tracing_subscriber::fmt::init();

    if args().len() == 1 {
        println!("please input a image path");
        std::process::exit(-1);
    }

    let cpu = CpuOf::<Riscv64>::new();
    let mem = MemoryOf::<Riscv64>::new(0x1_0000_0000);
    let mut debuger = Debugger::<Riscv64>::new(cpu, mem);

    debuger.load_img(Path::new(&args().nth(1).unwrap()))?;

    debuger.run();

    Ok(())
}
